<!--
 * @Description: 项目分类-错题
 * @Author: your name
 * @Date: 2024-07-24
 * @LastEditTime: 2024-07-24
 * @LastEditors: Please set LastEditors
-->

<template>
  <div class="heart_w proErrorClass">
    <div class="container" style="margin: 20px auto">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/studyPlan' }"
          >首页</el-breadcrumb-item
        >
        <el-breadcrumb-item
          :to="{ path: '/exam_practice/FRM/frmQuestionbank' }"
        >
          题库
        </el-breadcrumb-item>
        <el-breadcrumb-item>错题集</el-breadcrumb-item>
      </el-breadcrumb>

      <div class="outlineMain">
        <div class="collapse">
          <div class="collapseItem" ref="q2">
            <div class="innerCollapse">
              <div
                class="item"
                v-for="(item, index) in proList1"
                :key="item.id"
                :id="'quantitative' + (index + 1)"
              >
                <div class="innerTit" @click="LevelPro(item)">
                  {{ item.title }}
                </div>
                <div
                  class="childList"
                  v-for="i in proLevel2List2"
                  :key="i.id"
                  v-show="item.showChild"
                >
                  <div class="itemCon">
                    <div class="left">
                      <p>{{ i.title }}</p>
                    </div>
                    <div class="right">
                      <p>{{ i.yes }}</p>
                      <a @click="geterrList(i)" class="el-icon-link">
                        查看详情
                      </a>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- <div class="anchorLink">
          <a
            :href="'#quantitative' + Number(i + 1)"
            v-for="(e, i) in 5"
            :key="i"
            :class="{ active: linkid == i }"
            @click="linkTo(i)"
          >
            2024年CFA一级冲刺阶段模考卷（错题）
          </a>
        </div> -->
      </div>
    </div>
  </div>
</template>

<script>
import { getForLevel1ByError, getForLevel2 } from '@/api/proErrorClass'
export default {
  name: 'proErrorClass',
  data() {
    return {
      proList1: [],
      proLevel2List2: []
    }
  },
  created() {
    this.gerErrList()
    this.getLevel2List()
  },
  methods: {
    LevelPro(ite) {
      ite.showChild = !ite.showChild
    },
    async gerErrList() {
      const { data: data } = await getForLevel1ByError({ page: 1 })
      this.proList1 = data.data.list
      data.data.list.map((ele, index) => {
        this.$set(data.data.list[index], 'showChild', false)
      })
    },
    async getLevel2List() {
      const { data: data } = await getForLevel2({ cid: 2 })
      this.proLevel2List2 = data.data.list
    },
    geterrList() {
      this.$router.push({
        path: '/exam_practice/errorList',
        query: {}
      })
    }
  }
}
</script>

<style scoped lang="scss">
@import '@/assets/styles/index.scss';
@import '@/assets/styles/collectList.scss';
</style>
